
#!/bin/bash

#Script responseTime 0.1
#Desenvolvido por Juan Fontes. Script feito do zero. Alteracoes so sao permitidas com o consentimento do mesmo.

clear
Pathlog=/data/logs/jboss/jboss_server.log
msg="

*****************************************************************
                     !!! ATENCAO !!!
         Este script serve para  verificar o responseTime
                       dos servicos no MUM.
        Escolha a opcao correta digitando a opcao
          correspondente ou aperte 6 para Sair.

          PARA PARAR, BASTA PRESSIONAR CONTROL C
*****************************************************************

"
echo "$msg"
select var in "Verificar tempo VasSMSGateway" "Verificar tempo OCSBillingSender" "Verificar tempo OCSCreditVerifier" "Verificar tempo SMSMobileOriginatedNotifierMDB" "Verificar tempo RBT.ContentProvisioner" "Verificar tempo de resposta RBT" "Sair"; do

        break
done

	if [[ "$var" = "Verificar tempo VasSMSGateway" ]]
	then
        tailf $Pathlog |
       while read -r classe
      do
     [[ "$classe" != *com.m4u.mum.oi.smsmessage.VasSMSGateway* ]] && continue
		echo -n $classe | awk '{print $2 " - " $4 " - " $13}'

        done
	elif [[ ${var} == "Verificar tempo OCSBillingSender" ]]; then
        tailf $Pathlog |
       while read -r classe
      do
     [[ "$classe" != *com.m4u.mum.oi.billing.OCSBillingSender* ]] && continue
        echo -n $classe | awk '{print $2 " - " $4 " - " $15}'

        done

                elif [[ ${var} == "Verificar tempo OCSCreditVerifier" ]]; then
        tailf $Pathlog |
       while read -r classe
      do
     [[ "$classe" != *com.m4u.mum.oi.creditverifier.OCSCreditVerifier* ]] && continue
        echo -n $classe | awk '{print $2 " - " $4 " - " $14}'

        done

    elif [[ ${var} == "Verificar tempo SMSMobileOriginatedNotifierMDB" ]]; then
        tailf $Pathlog |
       while read -r classe
      do
     [[ "$classe" != *com.m4u.mum.callback.SMSMobileOriginatedNotifierMDB* ]] && continue
        echo -n $classe | awk '{print $2 " - " $4 " - " $13}'

        done


    elif [[ ${var} == "Verificar tempo RBT.ContentProvisioner" ]]; then
        tailf $Pathlog |
       while read -r classe
      do
     [[ "$classe" != *com.m4u.mum.oi.ringbacktone.ContentProvisioner* ]] && continue
        echo -n $classe | awk '{print $2 " - " $4 " - " $15}'

        done
	elif [[ ${var} == "Verificar tempo de resposta RBT" ]]; then
        tailf $Pathlog |
       while read -r classe
      do
     [[ "$classe" != *'serviceId\[RBT\_000\]'* ]] && continue
        echo -n $classe | awk '{print $2 " - " $4 " - " $14}'

        done
else
clear
echo
echo Script abortado, para executar novamente, digite: responseTime
echo
fi
